﻿using System;
using System.Text;
using LiteStarNote.bean;

namespace LiteStarNote
{
    public partial class TxtForm : Form
    {
        DataBaseManager dataBaseManager = new DataBaseManager();
        public TxtForm(string queryDateStart, string queryDateEnd, string queryType, string queryContent, string queryState)
        {
            InitializeComponent();
            showData(queryDateStart, queryDateEnd, queryType, queryContent, queryState);
        }

        public void showData(string queryDateStart, string queryDateEnd, string queryType, string queryContent, string queryState)
        {
            List<WorkListBean> workList = dataBaseManager.queryData(queryDateStart, queryDateEnd, queryType, queryContent, queryState);
            StringBuilder txtSb = new StringBuilder("");
            
            txtSb.Append("请将以下内容,整理成工作总结:");
            txtSb.Append(Environment.NewLine);
            txtSb.Append("请总结以下内容:");
            txtSb.Append(Environment.NewLine);
            txtSb.Append("请将以下工作内容汇总,并去重,但不要修改工作内容:");
            txtSb.Append(Environment.NewLine);
            foreach (WorkListBean work in workList)
            {
                if (work != null)
                {
                    // 第1个,新增问题类别,该事项已完成,工作内容: 修改了整理成txt的问题
                    txtSb.Append("第");
                    txtSb.Append(work.Num);
                    txtSb.Append("个,");
                    txtSb.Append(work.Type);
                    txtSb.Append("类别,该事项");
                    txtSb.Append(work.State);
                    txtSb.Append(",工作内容:");
                    string modifiedString = work.Content.Replace("\n", ".");
                    txtSb.Append(modifiedString);
                    txtSb.Append(Environment.NewLine);
                }
            }
            
            txt_Text.Text = txtSb.ToString();
        }

    }
}
